import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import {StompService, StompState} from '@stomp/ng2-stompjs';

@Component({
  selector: 'app-stomp-status',
  templateUrl: './stomp-status.component.html',
  styleUrls: ['./stomp-status.component.css']
})
export class StompStatusComponent implements OnInit {

  public state: Observable<string>;

  constructor(
    private stompService: StompService
  ) { }

  ngOnInit() {
    console.log('Status init');
    this.state = this.stompService.state
      .map((state: number) => StompState[state]);
  }

}
